<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="baidu-site-verification" content="JdMif0g2tL" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>angular</title>
</head>
<body ng-app="myApp">
<style type="text/css" media="screen">
	*{
		margin: 0;
		padding: 0;
	}
	span{
		color: red;
		font-size:14px; 
	}
</style>

<p>仅剩{{time}}小时，抓紧去死</p>

<script type="text/javascript">
	document.getElementsByTagName('html')[0].style.fontSize=window.screen.width/10+'px';
</script>
<script src="../js/angular.min.js" charset="utf-8"></script>
<script type="text/javascript">
	var app =angular.module('myApp', []);
	var date=new Date('2017-5-8 20:00:00').getTime();
	console.log(date);
	app.run(function ($rootScope,$interval) {
		function gitTimes(){
			//获取当前时间
			var nowTime=new Date().getTime();
			//获取时间差
			var t=date-nowTime;
			//计算小时
			var h=t/1000/60/60;
			//对小时去整并返回
			return h;
		}
		console.log(gitTimes()); 
		$rootScope.time=gitTimes();
		//循环定时做倒计时
		$interval(function(){
			$rootScope.time=gitTimes();
		},1000)
	})
</script>
</body>
</html>
<!--应该是14.11，时间-2017-05-08->